#ifndef _URL_H_
#define _URL_H_

/**
 * @file url.h/cpp
 * @version 1.0.0
 * @author how_fly@yahoo.com ( how_fly@yahoo.com )
 * @date 2008-08-24 created
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#include "md5.h"

#define URL_LEN 128

//only http now, ignore others
enum eURL_TYPE
{
	eURL_UNKNOWN = 0,
	eURL_HTTP = 1,
	eURL_HTTPs = 2,
	eURL_FTP = 3,
	eRUL_MAIL = 4,
	eURL_FILE = 5
};

struct url_t
{
	char szurl[URL_LEN];
};

url_t* create_url(const char* szurl, int len);
url_t* create_url(url_t* url);
int release_url(void* url);


int filter_url(char*& szurl, int& len);
//int put_url(url_t* url, char* szurl, int len);
void copy_url(url_t* src, url_t* dst);
int copy_allhost(url_t* url, char* host, int len); // no '/' at the end
void get_url_md5(url_t& url_, md5_t& md5_);


#endif
